<include file="Common/works/header"/>
<include file="Common/works/left_menu"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/waitMe.css"/>
<!-- <form action="/apiworks/apiAdd.html" class="right" id="tab1" method="post"> -->
<div action="/apiworks/apiAdd.html" class="right" id="tab1"
     method="post">
    <div class="faservice_title">
        <a href="/apiworks/index" title="我的服务">我的服务</a>&nbsp;&gt;&nbsp;{$info.service_name}&nbsp;&gt;&nbsp;添加API
    </div>
    <div class="faservice">
        <div class="column">
            <div class="fielbt">
                <span class="fielbtbt">新增API</span><span> <?php echo date('Y-m-d H:i:s',time());?>
				</span>
            </div>
        </div>
        <div class="column">
            <div class="fieldt">
                所属服务:<span>{$info.service_name}</span>
            </div>
        </div>
        <div class="column">
            <div class="field">API名称:</div>
            <input name="api_name" id="api_name" class="kt1 fl _api_name _blur_rz" opt-tip="请输入API名称"
                   placeholder="请填写中文名称，长度不超过10个字"/>

            <div id="api_name_id" class="error hide">
                <i></i><span id="api_name_msg"></span>
            </div>
        </div>
        <div class="column">
            <div class="field">英文名称:</div>
            <input name="api_name_en" id="api_name_en" class="kt1 _api_name_en fl _blur_rz"
                   autocomplete="on" placeholder="长度不超过30个字符" opt-tip="请输入API英文名称"/>

            <div class="commentaryt">&nbsp;&nbsp;1-30位英文、数字、下划线(必须以英文开头)</div>
            <div id="api_name_en_id" class="error hide">
                <i></i><span id="api_name_en_msg"></span>
            </div>
            <div class="cls"></div>
        </div>
        <div class="column">
            <div class="fieldd">
                用于生成云途数据的API地址：
                https://api.37degree.com/open/{$info.service_name_en}/<span
                    style="color: #1080f2">api_name</span> 保存后不能修改

            </div>
        </div>

        <div class="cls"></div>
        <div class="column">
            <div class="field">API介绍:</div>
			<textarea name="api_introduction" id="api_introduction"
                      class="textarea fl _api_introduction _blur_rz" placeholder="请填写API介绍，长度不超过500" opt-tip="请输入API介绍"
                      maxlength="500"/></textarea>
            <div id="api_introduction_id" class="error hide" style="margin-top: 36px">
                <i></i><span id="api_introduction_msg"></span>
            </div>
        </div>

        <div class="column">
            <div class="fieldt fl">请求方式:</div>
            <div class="classification">
                <input name="api_request_method" class="xz api_request_method"
                       type="radio" value="0" checked="checked"/> GET/POST
            </div>
            <div class="classification">
                <input name="api_request_method" class="xz api_request_method"
                       type="radio" value="1"/> POST
            </div>
            <div class="classification">
                <input name="api_request_method" class="xz api_request_method"
                       type="radio" value="2"/> GET
            </div>
            <div class="cls"></div>
        </div>
        <div class="column">
            <div class="fieldt fl">返回格式:</div>
            <div class="classification">
                <input name="api_result_format" class="xz _api_result_format"
                       type="radio" value="JSON" checked="checked"/> JSON
            </div>
            <div class="cls"></div>

        </div>
        <div class="column">
            <div class="fieldt">
                授权方式: <span>HTTP Basic Authentication</span> <input type="hidden"
                                                                    value="HTTP Basic Authentication"
                                                                    class="_api_authorized_type"/>
            </div>
        </div>
        <div class="column">
            <div class="fieldt fl">API地址 ：</div>
            <div class="slurl">
                http://{$info.service_host}/<span><input name="api_uri" id="api_uri" class="kt7 _api_uri _blur_rz"
                                                         opt-tip="请输入API地址" autocomplete="on" value=""/></span>
            </div>
            <div class="commentaryt">&nbsp;&nbsp;API完整的请求地址(不带参数)</div>
            <div id="api_uri_id" class="error hide">
                <i></i><span id="api_uri_msg"></span>
            </div>
            <div class="cls"></div>
        </div>

        <div class="column" style="width: 100%"></div>
        <div class="column">
            <div class="fieldt">请求参数:</div>
        </div>
        <div class="column">
            <div class="table-top">
                <div class="tab" style="width: 12%">参数名</div>
                <div class="tab" style="width: 12%">类型</div>
                <div class="tab" style="width: 12%">是否必填</div>
                <div class="tab" style="width: 31%">示例默认值</div>
                <div class="tab" style="width: 31%">说明</div>
            </div>

            <!-- 循环 -->
            <div jput="users" jput-jsondata='[]'>
                <div class="_raw_request_param">
                    <div class="table-foot fl _ul_li">
                        <div class="tab" style="width: 12%">
                            <input name="api_request_param" id="api_request_param" class="kt5 _api_request_param_input"
                                   onblur="javascript:checkValue(this,'._api_request_param_input');return false;"
                                   onfocus="javascript:rmError(this,'_api_request_param_input');return false;"
                                   autocomplete="on" maxlength="50" style="width:90%"/>
                        </div>
                        <div class="tab" style="width: 12%">
                            <div class="select">
                                <div>
                                    <select class="kt5 _api_request_param" id="api_request_param_type"
                                            onchange="javascript:selectChange(this,'api_request_param',$(this).val());return false;">
                                        <option value="string" selected="selected">string</option>
                                        <option value="number">number</option>
                                        <option value="boolean">boolean</option>
                                    </select>
                                    <input type="hidden" name="api_request_param" value="string"
                                           class="_api_request_param_type"/>
                                    <!--选中项值-->
                                </div>
                            </div>
                        </div>
                        <div class="tab" style="width: 12%">
                            <div class="select">
                                <div>
                                    <select class="kt5" id="api_request_param_master"
                                            onchange="javascript:selectChange(this,'api_request_param',$(this).val());return false;">
                                        <option value="1" selected="selected">是</option>
                                        <option value="0">否</option>
                                    </select>
                                    <input type="hidden" name="api_request_param" value="1"
                                           class="_api_request_param_master"/>
                                    <!--选中项值-->
                                </div>
                            </div>
                        </div>
                        <div class="tab" style="width: 31%">
                            <input name="api_request_param" id="" class="kt5"
                                   autocomplete="on"/>
                        </div>
                        <div class="tab" style="width: 31%">
                            <input name="api_request_param" id="" class="kt5"
                                   autocomplete="on"/>
                        </div>
                    </div>
                    <div class="commentaryy">
                        <a href="javascript:void(0)" class="_request_param_del">删除</a>
                    </div>
                </div>
            </div>
            <!-- 循环 -->
        </div>
        <div class="cls"></div>
        <div class="column" style="height: 50px; margin-top: 16px">
            <a href="javascript:void(0)" id="save" class="cobed" title="继续添加">继续添加</a>
        </div>

        <div class="column">
            <div class="fieldt">返回字段:</div>
        </div>
        <div class="column">
            <div class="table-top">
                <div class="tab" style="width: 33%">字段名</div>
                <div class="tab" style="width: 33%">类型</div>
                <div class="tab" style="width: 33%">说明</div>
            </div>

            <!-- 循环 -->
            <div jput="users1" jput-jsondata='[]'>
                <div class="_raw_return_param">
                    <div class="table-foot fl">
                        <div class="tab" style="width: 33%">
                            <!-- <input name="api_result_field" id="" class="kt5 warning" autocomplete="on" maxlength="50" /> -->
                            <input name="api_result_field"
                                   onblur="javascript:checkValue(this,'._api_result_field');return false;"
                                   onfocus="javascript:rmError(this);return false;" class="kt5 _api_result_field"
                                   autocomplete="on" maxlength="50"/>
                        </div>
                        <div class="tab" style="width: 33%">
                            <div class="select" style="width:97%">
                                <div style="width:100%">
                                    <select class="kt5" style="width:100%"
                                            onchange="javascript:selectChange( this,'api_result_field',$(this).val());return false;">
                                        <option value="string">string</option>
                                        <option value="number">number</option>
                                        <option value="boolean">boolean</option>
                                    </select>
                                    <input type="hidden" name="api_result_field" value="string"
                                           class="_api_return_result_type"/>
                                    <!--选中项值-->
                                </div>
                            </div>
                        </div>
                        <div class="tab" style="width: 33%">
                            <input name="api_result_field" id="" class="kt5" autocomplete="on"/>
                        </div>
                    </div>
                    <div class="commentaryy">
                        <a href="javascript:void(0)" class="_return_param_del">删除</a>
                    </div>
                </div>
            </div>
            <!-- 循环 -->

        </div>
        <div class="cls"></div>
        <div class="column" style="height: 50px; margin-top: 16px">
            <a href="javascript:void(0)" id="save1" class="cobed" title="继续添加">继续添加</a>
        </div>
        <div class="column">
            <div class="fieldt">返回示例(JSON/XML):</div>
        </div>
        <div class="column" style="width: 100%">
			<textarea name="api_result_sample" id="column"
                      class="textarea1 _api_result_sample" autocomplete="on"/></textarea>
        </div>
        <div class="column">
            <div class="fieldt">错误码:</div>
        </div>
        <div class="column">
            <div class="table-top">
                <div class="tab" style="width: 33%">错误码</div>
                <div class="tab" style="width: 33%">错误信息</div>
                <div class="tab" style="width: 33%">错误码返回说明</div>
            </div>

            <!-- 循环 -->
            <div jput="users2" jput-jsondata='[]'>
                <div class="_raw_error_param">
                    <div class="table-foot fl">
                        <div class="tab" style="width: 33%">
                            <!-- <input name="api_error_codes" id="name" class="kt5 warning" autocomplete="on" maxlength="50" /> -->
                            <input name="api_error_codes" id="name" class="kt5 _api_error_codes"
                                   onblur="javascript:checkErrorCodeValue(this,'._api_error_codes');return false;"
                                   onfocus="javascript:rmError(this);return false;" autocomplete="on" maxlength="50"/>
                        </div>
                        <div class="tab" style="width: 33%">
                            <input name="api_error_codes" id="" class="kt5" autocomplete="on"/>
                        </div>
                        <div class="tab" style="width: 33%">
                            <input name="api_error_codes" id="" class="kt5" autocomplete="on"/>
                        </div>
                    </div>
                    <div class="commentaryy">
                        <a href="javascript:void(0)" class="_error_param_del">删除</a>
                    </div>
                </div>
            </div>
            <!-- 循环 -->
        </div>
        <div class="cls"></div>
        <div class="column" style="height: 50px; margin-top: 16px">
            <a href="javascript:void(0)" id="save2" class="cobed" title="继续添加">继续添加</a>
        </div>
        <div class="column">
            <div class="fieldt fl">数据更新类型:</div>
            <div class="classification">
                <input name="api_update_type" class="xz"
                       type="radio" value="1" checked="checked"/> 实时更新
            </div>
            <div class="classification">
                <input name="api_update_type" class="xz"
                       type="radio" value="2"/> 静态数据
            </div>
            <div class="cls"></div>
        </div>
        <div class="column _chargeType">
            <div class="fieldt fl">收费类型:</div>
            <div class="classification">
                <input name="api_is_charge" class="xz"
                       type="radio" value="0" checked="checked"/> 免费
            </div>
            <div class="classification">
                <input name="api_is_charge" class="xz"
                       type="radio" value="1"/> 收费（设置资费规则，请联系support@37degree.com）
            </div>
            <div class="cls"></div>
        </div>


        <!-- 2016-8-3 -->
        <div class="column _mainJudge" style="display: none;">
            <div class="table-top">
                <div class="tab" style="width:20%">套餐周期</div>
                <div class="tab" style="width:20%">价格</div>
                <div class="tab" style="width:20%">调用次数</div>
                <div class="tab" style="width:20%">每次返回</div>
                <div class="tab" style="width:19%">并发次数</div>
            </div>
            <div class="_raw_error_param _addJudge">
                <div class="table-foot fl">
                    <div class="tab" style="width:20%"><select class="kt5 _api_request_param"
                                                               id="api_request_param_type">
                        
                        <option value="1个月">1个月</option>
                        <option value="3个月">3个月</option>
                        <option value="半年">半年</option>
                        <option value="一年">一年</option>
                    </select><input type="hidden" name="api_date" value="1个月" class="_api_request_param_type"></div>
                    <div class="tab" style="width:20%"><input name="" mandatory="on" value="" class="kt5 _selling_price"
                                                              autocomplete="off" maxlength="50" style="width:80%"><span
                            class="package-danwei">元</span></div>
                    <div class="tab" style="width:20%"><input name="" mandatory="on" value="" class="kt5 _int_num"
                                                              autocomplete="off" maxlength="50" style="width:80%"><span
                            class="package-danwei">次</span></div>
                    <div class="tab" style="width:20%"><input name="" value="" class="kt5 _int_num" autocomplete="off"
                                                              maxlength="50" style="width:80%"><span
                            class="package-danwei">条</span></div>
                    <div class="tab" style="width:19%"><input name="" value="" class="kt5 _int_num" autocomplete="off"
                                                              maxlength="50" style="width:70%"><span
                            class="package-danwei" style="width:22%">次/秒</span></div>
                </div>
                <div class="commentaryy "></div>
            </div>
        </div>

        <div class="cls"></div>
        <div class="column _mainJudge_2" style="height:50px; margin-top:16px; display:none"><a href="javascript:void(0)"
                                                                                               class="cobed _setMeal"
                                                                                               title="继续添加">继续添加</a>
        </div>


        <!-- 2016-8-3 end -->


        <div class="commentaryt">如果您已在其他平台发布该API，请填写其他平台的链接，帮助您更快通过审核，如果没有请勿填写。</div>
        <div class="column" style="width: 100%">
            <input name="api_other_platform_sample"
                   id="api_other_platform_sample"
                   class="kt6 _api_other_platform_sample" autocomplete="on"
                   maxlength="50" value=""/>
        </div>
        <div class="column" style="margin-top: 20px">
            <button type="button" class="confirm _api_save" id="register">保存</button>
            <button type="button" class="confirm _api_add_submit" style="margin-left:14px" id="register_api">提交审核
            </button>
            <div class="cls"></div>

        </div>
    </div>
    <!-- </form> -->
</div>
<div id="continueBox" class="grantdiv">
    <div class="hz">
        <div class="hztop"><a href="javascript:void(0)" title="关闭窗口" class="close_btn _close_btn"><img
                src="__PUBLIC__/home/images/no.png"/></a></div>
        <div class="hzcp">
            <p>API添加成功，是否继续添加API?</p>
        </div>
        <div class="mydiv-foot" style=" width:250px; margin:0 auto"><a href="javascript:void(0)"
                                                                       class="smthree fl _close_btn">取消</a><a
                class="smtwo fr _confirm_btn">继续添加</a></div>
    </div>
</div>
<input type="hidden" value="{$info.service_id}" class="_service_id"/>
<input type="hidden" value="{$info.service_name_en}"
       class="_service_name_en"/>
<input type="hidden" value="{$info.service_name}" class="_service_name"/>
<input type="hidden" value="" class="_api_id"/>
</div>
</body>
<script src="__PUBLIC__/home/js/jput-2.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/serviceapi_common.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/apiadd.js"></script>
<script src="__PUBLIC__/home/js/waitMe.js"></script>
<script src="__PUBLIC__/home/js/apiadd-add.js" type="text/javascript" charset="utf-8"></script>
</html>
